/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.una.pol.ii.is2.domain.flota;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "marca")
@NamedQueries({@NamedQuery(name = "Marca.findAll", query = "SELECT m FROM Marca m"), @NamedQuery(name = "Marca.findByMarcCod", query = "SELECT m FROM Marca m WHERE m.marcCod = :marcCod"), @NamedQuery(name = "Marca.findByMarcNombre", query = "SELECT m FROM Marca m WHERE m.marcNombre = :marcNombre"), @NamedQuery(name = "Marca.findByMarcDescripcion", query = "SELECT m FROM Marca m WHERE m.marcDescripcion = :marcDescripcion")})
public class Marca implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="marca_generator")
    @SequenceGenerator(name="marca_generator", sequenceName="marca_marc_cod_seq", allocationSize=1)
    @Basic(optional = false)
    @Column(name = "marc_cod")
    private Integer marcCod;
    @Basic(optional = false)
    @Column(name = "marc_nombre")
    private String marcNombre;
    @Basic(optional = false)
    @Column(name = "marc_descripcion")
    private String marcDescripcion;
    @OneToMany(cascade = CascadeType.MERGE, mappedBy = "marca")
    private Collection<MarcaModelo> marcaModeloCollection;

    public Marca() {
    }

    public Marca(Integer marcCod) {
        this.marcCod = marcCod;
    }

    public Marca(Integer marcCod, String marcNombre, String marcDescripcion) {
        this.marcCod = marcCod;
        this.marcNombre = marcNombre;
        this.marcDescripcion = marcDescripcion;
    }

    public Integer getMarcCod() {
        return marcCod;
    }

    public void setMarcCod(Integer marcCod) {
        this.marcCod = marcCod;
    }

    public String getMarcNombre() {
        return marcNombre;
    }

    public void setMarcNombre(String marcNombre) {
        this.marcNombre = marcNombre;
    }

    public String getMarcDescripcion() {
        return marcDescripcion;
    }

    public void setMarcDescripcion(String marcDescripcion) {
        this.marcDescripcion = marcDescripcion;
    }

    public Collection<MarcaModelo> getMarcaModeloCollection() {
        return marcaModeloCollection;
    }

    public void setMarcaModeloCollection(Collection<MarcaModelo> marcaModeloCollection) {
        this.marcaModeloCollection = marcaModeloCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (marcCod != null ? marcCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Marca)) {
            return false;
        }
        Marca other = (Marca) object;
        if ((this.marcCod == null && other.marcCod != null) || (this.marcCod != null && !this.marcCod.equals(other.marcCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.una.pol.ii.is2.dao.flota.Marca[marcCod=" + marcCod + "]";
    }

}
